const LinkUrl = require('plublic.js');
var app = getApp();
var PostData = function(options, callback, opeType, isdata) {
  var that = this
  wx.request({
    url: LinkUrl.URLLINK + '/' + opeType,
    header: {
      'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
    },
    method: 'POST',
    data: options.data,
    success: function(res) {
      if (res == null || res.data == null) {
        console.log('网络请求失败');
        return;
      }
      callback(res)
    }
  })
}

function json2Form(json, opeType, isdata) {
  var thereturn = opeType;
  if (isdata != 0) {
    thereturn = thereturn + '?jsonParam=' + JSON.stringify(json);
  }

  return thereturn;
}

module.exports = PostData;